CC=gcc
AR=ar
CWD=$(shell pwd)
BINPATH=bin
OBJPATH=objs
LIBPATH=lib
APPPATH=$(CWD)/../app
EXPORTDIR=$(CWD)/../exports
APP=detector


SYSCOREPATH=$(CWD)/../syscore

IOPTION=-I$(EXPORTDIR) 
LOPTIONS=-L$(LIBPATH) -lpthread -lsyscore 
COPTIONS=

NCOPTIONS=$(COPTIONS)

OBJS=\
	$(OBJPATH)/main.o

LIBS=\
	SYSLIB

$(APP): action  $(LIBS) $(OBJS)
	$(CC) -o $(BINPATH)/$(APP) $(OBJS) $(LOPTIONS)
	
%.o:
	$(CC) -c $(NCOPTIONS) $(IOPTION) $(APPPATH)/$(*F).c -o $@   
	

action:
	@mkdir -p $(OBJPATH)
	@mkdir -p $(LIBPATH)
	@mkdir -p $(BINPATH)
	
SYSLIB:
	cd $(SYSCOREPATH);make 
	
clean:
	@rm -f $(BINPATH)/$(APP) $(LIBPATH)/* $(OBJPATH)/*

